package com.rgs.se.sort;

/**
 * @author Ren Gaoshuai
 * @ClassName Insert
 * @Description TODO
 * @date 2021-08-22 20:14
 **/
public class Insert {
    public static void main(String[] args) {
        int[] arr = {8,2,6,7,12,59,15,12,13,3};
        int i,j;
        for (i = 1; i < arr.length; i++) {
            int key = arr[i];
            for (j = i-1; j>=0 && key < arr[j]; j--) {
                arr[j+1] = arr[j];
            }
            arr[j+1] = key;
        }
        for (int i1 : arr) {
            System.out.print(i1+",");
        }

    }
}
